#pragma once
#include <iostream>
#include "SDLComponent.h"
#include "SDLTime.h"

class Timer : public SDLComponent
{
public:
	Timer(float duration);
	~Timer();

	void Start();
	void Stop();
	void Update();
	void Reset();

	bool IsCompleted(){ return (!mIsActive && mTime >= mDuration); }
	bool IsCounting(){ return mIsActive; }

	float GetDuration(){ return mDuration; }
	float GetTime(){ return mTime; }

	void SetActive(bool active){ mIsActive = active; }
	void SetDuration(float duration){ mDuration = duration; }
	void SetDurationAndReset(float duration){ mDuration = duration; Reset(); }
	void SetTime(float time){ mTime = time; }

private:
	bool mIsActive;
	float mDuration;
	float mTime;
};